package pdi.IO;

import java.io.File;
import java.io.FilenameFilter;
import java.util.List;

import pdi.core.Image;


import utils.MyUtils;


public abstract class ImgReader {

	private final static String jpgFormat = ".jpg";
	private final static String pngFormat = ".png";

	public abstract void open();
	public abstract void close();
	public abstract Image readNext();
	public abstract List<Image> readAll();


	protected File[] getAllImageFiles(String dirPath) {

		FilenameFilter filter = new FilenameFilter() {
			public boolean accept(File dir, String name) {
				return name.endsWith(jpgFormat) || name.endsWith(pngFormat);
			}
		};
		return MyUtils.getAllFiles(dirPath, filter);
	}
}
